#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author:Charles.chen
# createDate:2017/9/20
# Title:
# Tip:
from flask import render_template, redirect, request, url_for, flash, session
from app.internet import internetService
from app.system import systemService
from app.internet import internetService
from . import guideBp
import json


# 欢迎页面
@guideBp.route('/welcome', methods=['GET'])
def welcome():
    return render_template('guide/welcome.html')

# 上行网络设置
@guideBp.route('/guide', methods=['GET'])
def guide():
    wifiList = internetService.getAPSList()
    wifiList = ['wifi1', 'wifi2', 'wifi3', 'wifi4', 'wifi5']
    return render_template('guide/guide.html', wifiList=wifiList)
    pass

# 用户信息设置
@guideBp.route('/userInfo', methods=['GET'])
def userInfo():
    userConfig = systemService.getUserConfig()
    return render_template('guide/guideinfo.html', userData=json.loads(json.dumps(userConfig)))

# 服务器设置
@guideBp.route('/settingup', methods=['GET'])
def settingup():
    serverConfig = systemService.getServerConfig()
    if serverConfig["server_name"]==None:
        connectStatus = None
    else:
        connectStatus = internetService.checkInternet(serverConfig["server_name"])
    serverConfig["connectStatus"] = connectStatus
    return render_template('guide/settingup.html', serverData=json.loads(json.dumps(serverConfig)))

# 微尘设置
@guideBp.route('/settingdown', methods=['GET'])
def settingdown():
    return render_template('guide/settingdown.html')

# 向导结束
@guideBp.route('/end', methods=['GET'])
def end():
    return render_template('guide/end.html')

# ----------------------



if __name__ == '__main__':
    pass



#